package cn.edu.zjut.mina.po;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.springframework.format.annotation.DateTimeFormat;


/**
 * 总的游戏结果统计
 * @author 张宇翔
 */
@Table(name="t_totalGameResult")
@Entity
public class TotalGameResult {
	private Integer totalGameResultId;//本次游戏的Id  (主键)
	private String roomId;//房间号
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	private Date beginTime;//开始时间    开始时间是游戏开始的时间还是开房时间
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	private Date endTime;//结束时间
	private Integer number_of_games;//游戏局数  (最多可玩局数)
	private Integer actual_number_of_games;//实际游戏局数
	private Integer criticalOfTwoTimes;//2倍的临界值(也就是包不包含7)
	private Integer participation;//参与人数
	private Integer lzxs;//轮庄形式        1    固定庄       0     破牛庄
	private Integer ratio;//起点倍率   1,2,3
	//private String[] playerIds;//所有其他玩家的Id   不包括开房人
	private String createRoomPlayerId;//开房玩家的Id
	//private String[] everyGameResultIds;//一次游戏中包含的所有局游戏结果的id
	private List<EveryGameResult> everyGameResults;//一次游戏中包含的对局信息
	private Integer deductRoomCard;//需要扣除的房卡数
	private Integer constraintQuitRoom;//1   直接退出的房间    0  玩过至少一局
	
	
	@GeneratedValue
	@Id
	public Integer getTotalGameResultId() {
		return totalGameResultId;
	}
	public void setTotalGameResultId(Integer totalGameResultId) {
		this.totalGameResultId = totalGameResultId;
	}
	public String getRoomId() {
		return roomId;
	}
	public void setRoomId(String roomId) {
		this.roomId = roomId;
	}
	public Date getBeginTime() {
		return beginTime;
	}
	public void setBeginTime(Date beginTime) {
		this.beginTime = beginTime;
	}
	public Date getEndTime() {
		return endTime;
	}
	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}
	public Integer getNumber_of_games() {
		return number_of_games;
	}
	public void setNumber_of_games(Integer number_of_games) {
		this.number_of_games = number_of_games;
	}
	public Integer getActual_number_of_games() {
		return actual_number_of_games;
	}
	public void setActual_number_of_games(Integer actual_number_of_games) {
		this.actual_number_of_games = actual_number_of_games;
	}
	public Integer getCriticalOfTwoTimes() {
		return criticalOfTwoTimes;
	}
	public void setCriticalOfTwoTimes(Integer criticalOfTwoTimes) {
		this.criticalOfTwoTimes = criticalOfTwoTimes;
	}
	public Integer getParticipation() {
		return participation;
	}
	public void setParticipation(Integer participation) {
		this.participation = participation;
	}
	public Integer getLzxs() {
		return lzxs;
	}
	public void setLzxs(Integer lzxs) {
		this.lzxs = lzxs;
	}
	public Integer getRatio() {
		return ratio;
	}
	public void setRatio(Integer ratio) {
		this.ratio = ratio;
	}
	public String getCreateRoomPlayerId() {
		return createRoomPlayerId;
	}
	public void setCreateRoomPlayerId(String createRoomPlayerId) {
		this.createRoomPlayerId = createRoomPlayerId;
	}
	@OneToMany(mappedBy = "totalGameResult", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	public List<EveryGameResult> getEveryGameResult() {
		return everyGameResults;
	}
	public void setEveryGameResult(List<EveryGameResult> everyGameResults) {
		this.everyGameResults = everyGameResults;
	}
	
	public void clear() {
		//this.actual_number_of_games = null;
	}
	public Integer getDeductRoomCard() {
		return deductRoomCard;
	}
	public void setDeductRoomCard(Integer deductRoomCard) {
		this.deductRoomCard = deductRoomCard;
	}
	public Integer getConstraintQuitRoom() {
		return constraintQuitRoom;
	}
	public void setConstraintQuitRoom(Integer constraintQuitRoom) {
		this.constraintQuitRoom = constraintQuitRoom;
	}
}
